import sqlite3

def count_db(db_path):
    try:
        conn = sqlite3.connect(db_path)
        cursor = conn.cursor()
        
        # 查询notice_table
        cursor.execute("SELECT COUNT(*) FROM notice_table")
        notice = cursor.fetchone()[0]
        
        # 查询target_table
        cursor.execute("SELECT COUNT(*) FROM target_table")
        target = cursor.fetchone()[0]
        
        # 查询goods_table
        cursor.execute("SELECT COUNT(*) FROM goods_table")
        goods = cursor.fetchone()[0]
        
        conn.close()
        return (notice, target, goods)
    except Exception as e:
        return (f"错误: {e}", 0, 0)

# 查询jntujy.db
notice1, target1, goods1 = count_db("jntujy.db")
print("jntujy.db 记录数:")
print(f"notice_table: {notice1}")
print(f"target_table: {target1}")
print(f"goods_table: {goods1}")
print(f"总记录数: {notice1 + target1 + goods1 if isinstance(notice1, int) else '无法计算'}")

print("\n")

# 查询jntujy11.db
notice2, target2, goods2 = count_db("jntujy11.db")
print("jntujy11.db 记录数:")
print(f"notice_table: {notice2}")
print(f"target_table: {target2}")
print(f"goods_table: {goods2}")
print(f"总记录数: {notice2 + target2 + goods2 if isinstance(notice2, int) else '无法计算'}")